package Decorator.seasoning;

import Decorator.basic.Beverage;
import Decorator.basic.CondimentDecorator;

/**
 * 摩卡
 */

public class Mocha extends CondimentDecorator {

    Beverage beverage;

    //为了让Mocha能够引用一个Beverage，通过构造器将饮料当作构造器的参数记录在实例变量中
    public Mocha(Beverage beverage) {
        this.beverage = beverage;
    }
//
    @Override
    public String getDescription() {
        return beverage.getDescription() + ",Mocha";
    }

    @Override
    public double cost() {
        return beverage.cost() + 0.2;
    }
}
